//
//  APIResponse.h
//  OCStarterProject
//
//  Created by huaya on 2025/10/2.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/// API响应状态码
typedef NS_ENUM(NSInteger, APIResponseCode) {
    APIResponseCodeSuccess = 200,           // 成功
    APIResponseCodeBadRequest = 400,        // 请求错误
    APIResponseCodeUnauthorized = 401,      // 未授权
    APIResponseCodeForbidden = 403,         // 禁止访问
    APIResponseCodeNotFound = 404,          // 资源不存在
    APIResponseCodeServerError = 500,       // 服务器错误
    APIResponseCodeNetworkError = -1001,    // 网络错误
    APIResponseCodeTimeout = -1002,         // 请求超时
    APIResponseCodeUnknown = -1             // 未知错误
};

@interface APIResponse : NSObject

/// 响应码
@property (nonatomic, assign) NSInteger code;

/// 响应消息
@property (nonatomic, copy) NSString *message;

/// 响应消息2
@property (nonatomic, copy) NSString *msg;

/// 响应数据
@property (nonatomic, strong) id data;

/// 时间戳
@property (nonatomic, assign) NSTimeInterval timestamp;

/// 是否成功
@property (nonatomic, assign, readonly) BOOL isSuccess;

@end

NS_ASSUME_NONNULL_END
